from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains

driver = webdriver.Chrome()

driver.get("https://www.baidu.com")

inputtag = driver.find_element(By.ID,'kw')

submittag = driver.find_element(By.ID,'su')

# 建立行为链
actions = ActionChains(driver)

# 给搜索框发送数据
actions.move_to_element(inputtag)
actions.send_keys_to_element(inputtag,'python')

# 选中提交按钮，并提交
actions.move_to_element(submittag)
actions.click(submittag)

# 统一执行
actions.perform()